<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>报警管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var  cc;
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
                    loading('正在提交，请稍等...');
					form.submit();
                },
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            // $("#btnSubmit").click(function () {
				// $("#btnSubmit").hide();
            // })
            // function isCardNo(card)
            // {
            //     // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
            //     var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            //     if(reg.test(card) === false)
            //     {
            //         alert("身份证输入不合法");
            //         return  false;
            //     }
            // }
            // $("#idCard").keyup(function(){
            //     var length=this.value.length;
            //     // if(length!=18){
            //     //     $(".idremark").css("display","none");
            //     // }
            //     if(length===18){
            //         var reg =/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
            //         if(reg.test(this.value) === false)
            //         {
            //             $(".idremark").html("<span style='color: red'>身份证输入不合法!!检查有效性</span>")
            //         }else {
            //             $(".idremark").html("<span style='color: green'>身份证经过审核有效！！！</span>")
				// 	}
            //     }
            //
            //
            // });
            $('#idCard').bind('input propertychange', function() {
                cc = $(this).val().length;
                if(cc==18) {
                    var reg = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
                    if (reg.test(this.value) === false) {
                        $(".idremark").append("<span style='color: red'>身份证输入不合法!!检查有效性</span>")
                    } else {
                        $(".idremark").append("<span style='color: green'>身份证经过审核有效！！！</span>")
                    }
                }
            })

        });
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/member/member/">报警列表</a></li>
		<li class="active"><a href="${ctx}/sys/member/member/form?id=${member.id}">报警<shiro:hasPermission name="sys:member:member:edit">${not empty member.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:member:member:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="member" action="${ctx}/sys/member/member/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">姓名：</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系方式：</label>
			<div class="controls">
				<form:input path="phone" htmlEscape="false" maxlength="11" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">性别：</label>
			<div class="controls">
				<form:select path="sex" class="input-xlarge ">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span style="color: red">可不填写，根据身份证信息自动填入</span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">报案时间：</label>
			<div class="controls">
				<input name="baTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${member.baTime}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">投保时间：</label>
			<div class="controls">
				<input name="tbTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${member.tbTime}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">身份证号：</label>
			<div class="controls">
				<form:input path="idCard" id="idCard" htmlEscape="false" maxlength="18" class="input-xlarge "/>
				<span class="idremark" style="color: red">*</span></div>
		</div>
		<div class="control-group">
			<label class="control-label">地区：</label>
			<div class="controls">
				<sys:treeselect id="dq" name="dq" value="${member.dqName}" labelName="" labelValue="${member.dqName}"
					title="部门" url="/sys/office/treeData?type=2" cssClass="" allowClear="true" notAllowSelectParent="true"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="sys:member:member:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>